[FEATURE] Add sorting modes to the plugin store#4398
[FEATURE] Add sorting modes to the plugin store#4398Jack251970 merged 5 commits intoFlow-Launcher:devfrom
Conversation
- Added new row in header - Added dropdown menu to that new row - Added localized options: "Name", "Release Date," "Updated Date" as well as a localized label "Sorting Mode:" No functionality added, only ui changes.
- Add GetSortedPlugins to handle different sorts based on the SelectedSortMode - Show only "None"/"Plugins" & "Installed" categories for sort modes other than default
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds Plugin Store sorting: localization entries, a sort-mode enum and dropdown bound to the view model, plugin item date/category properties, sorting logic in the view model, and dynamic grouping updates in the view code-behind. No existing keys removed. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as Sort ComboBox
participant VM as SettingsPanePluginStoreViewModel
participant CB as SettingsPanePluginStore.xaml.cs
participant CVS as CollectionViewSource
participant Items as PluginStoreItemViewModel List
User->>UI: select sort mode
UI->>VM: set SelectedSortMode
VM->>VM: raise PropertyChanged("SelectedSortMode") and ("ExternalPlugins")
VM->>Items: GetSortedPlugins(SelectedSortMode)
Items->>Items: sort by Name / DateAdded / UpdatedDate or by DefaultCategory
VM->>CB: PropertyChanged observed
CB->>CB: UpdateCategoryGrouping()
CB->>CVS: clear/add GroupDescriptions (DefaultCategory or InstallCategory)
CB->>CVS: Refresh()
CVS->>UI: update displayed items
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs (1)
44-64:⚠️ Potential issue | 🟠 MajorPotential null reference issue with nullable DateTime arithmetic.
_newPlugin.LatestReleaseDateand_newPlugin.DateAddedareDateTime?(perUserPlugin.cslines 68-73). Subtracting a nullableDateTime?fromDateTime.Nowwithout null checks can cause runtime exceptions or undefined behavior when these values are null.🛠️ Proposed fix with null checks
public string DefaultCategory { get { string category = None; - if (DateTime.Now - _newPlugin.LatestReleaseDate < TimeSpan.FromDays(7)) + if (_newPlugin.LatestReleaseDate.HasValue && + DateTime.Now - _newPlugin.LatestReleaseDate.Value < TimeSpan.FromDays(7)) { category = RecentlyUpdated; } - if (DateTime.Now - _newPlugin.DateAdded < TimeSpan.FromDays(7)) + if (_newPlugin.DateAdded.HasValue && + DateTime.Now - _newPlugin.DateAdded.Value < TimeSpan.FromDays(7)) { category = NewRelease; } if (_oldPluginPair != null) { category = Installed; } return category; } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs` around lines 44 - 64, The DefaultCategory getter performs DateTime.Now - _newPlugin.LatestReleaseDate and DateTime.Now - _newPlugin.DateAdded where those fields are nullable (DateTime?); guard these uses by checking _newPlugin.LatestReleaseDate.HasValue and _newPlugin.DateAdded.HasValue (or using GetValueOrDefault with an existence check) before doing the subtraction, and only assign RecentlyUpdated/NewRelease when the corresponding nullable has a value; keep the existing logic around _oldPluginPair and the returned category intact.
🧹 Nitpick comments (1)
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs (1)
88-105: Minor formatting inconsistency.Line 102:
else{is missing a space before the brace.🔧 Suggested fix
// Otherwise we only split by installed or not - else{ + else + { groupDescriptions.Add(new PropertyGroupDescription(nameof(PluginStoreItemViewModel.InstallCategory))); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs` around lines 88 - 105, The method UpdateCategoryGrouping has a formatting inconsistency: change the `else{` to `else {` to match project style; update the else block in UpdateCategoryGrouping (which currently adds a PropertyGroupDescription for PluginStoreItemViewModel.InstallCategory when _viewModel.SelectedSortMode is not PluginStoreSortMode.Default) so the brace spacing is corrected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs`:
- Around line 44-64: The DefaultCategory getter performs DateTime.Now -
_newPlugin.LatestReleaseDate and DateTime.Now - _newPlugin.DateAdded where those
fields are nullable (DateTime?); guard these uses by checking
_newPlugin.LatestReleaseDate.HasValue and _newPlugin.DateAdded.HasValue (or
using GetValueOrDefault with an existence check) before doing the subtraction,
and only assign RecentlyUpdated/NewRelease when the corresponding nullable has a
value; keep the existing logic around _oldPluginPair and the returned category
intact.
---
Nitpick comments:
In `@Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs`:
- Around line 88-105: The method UpdateCategoryGrouping has a formatting
inconsistency: change the `else{` to `else {` to match project style; update the
else block in UpdateCategoryGrouping (which currently adds a
PropertyGroupDescription for PluginStoreItemViewModel.InstallCategory when
_viewModel.SelectedSortMode is not PluginStoreSortMode.Default) so the brace
spacing is corrected.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 64000be2-df6c-4096-9f7e-77ba3461f3b4
📒 Files selected for processing (5)
Flow.Launcher/Languages/en.xamlFlow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.csFlow.Launcher/SettingPages/Views/SettingsPanePluginStore.xamlFlow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.csFlow.Launcher/ViewModel/PluginStoreItemViewModel.cs
This is unrelated to my change, this is an issue in the existing code. |
Jack251970
left a comment
There was a problem hiding this comment.
Severity Count Data Context Binding Path Target Target Type Description File Line Project
Error 1408 PluginStoreItemViewModel IcoPathAbsolute Image.Source ImageSource IcoPathAbsolute property not found on object of type PluginStoreItemViewModel. D:\Source\Repos\Flow.Launcher - DavidGBrett\Flow.Launcher\SettingPages\Views\SettingsPanePluginStore.xaml 357 Flow.Launcher
Could you please resolve this binding issue?
Hi @Jack251970 As that issue is actually an existing one unrelated to this change I proposed a fix in a new PR: #4405 |
|
🥷 Code experts: Jack251970 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
Jack251970
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
I've opened a new PR ( #4406 ) to resolve this existing issue seperately as well. |
|
Thanks for your fix! |
Summary
Add dropdown with sorting modes to the plugin store panel of the settings window.
Added the following modes:
Default matches the current way it lists plugins, included the recently added / recently updated categories.
The other modes hide those categories as they no longer make sense / are needed, leaving only "Plugins" and "Installed".
Related to this request:
https://www.reddit.com/r/FlowLauncher/comments/1s8gcrm/plugin_sort_by_date_created_or_updated/
Closes #2845
UI
Summary by cubic
Adds sorting modes to the Plugin Store with a new dropdown (Default, Name, Release Date, Updated Date). Non‑default sorts collapse categories to only “Installed” and “Plugins”.
Summary of changes
.github/actions/spelling/expect.txtfor CI.PluginStoreSortModeenum (Default, Name, ReleaseDate, UpdatedDate) with localized labels and a "Sorting Mode:" label.DateAddedandUpdatedDatetoPluginStoreItemViewModelfor sorting.InstallCategoryandUpdateCategoryGroupingto switch grouping when sort mode changes.Categoryproperty (replaced byDefaultCategoryandInstallCategory).Written for commit 6f44d0c. Summary will update on new commits.